#include <stdio.h>
#include <windows.h>
#include <wininet.h>

#define IHOOK_CALL_STDCALL
#include "hookit.h"
//#pragma comment(lib, "wininet.lib")
#pragma comment(lib, "libihook_vs.lib")
#pragma comment(lib, "legacy_stdio_definitions.lib ")

int p_address = 0;

void MyHookPro() 
{
	printf("hook success%d\n", 5);
}

extern "C" __declspec(dllexport) BOOL APIENTRY DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
	DWORD   id = 0;
	extern const char __ihook_version__[];

	switch (fdwReason)
	{
		case DLL_PROCESS_ATTACH:
		{
			int dr_base = (int)GetModuleHandle(NULL);
			p_address = dr_base + 0x1010;
			MessageBoxA(NULL, "DLL", "I'm DLL", MB_OK);
			hookitByAddress(p_address, (DWORD)&MyHookPro);
			break;
		}

		case DLL_PROCESS_DETACH:
			unhookByAddress(p_address);
			break;
	}
	return TRUE;
}
